<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *挪车记录
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
if($_RQ['op']=='list'){
	$params=array();
	$params['uniacid']=$_SESSION['uniacid'];
	if(!empty($_RQ['mover_id'])){
		$params['mover_id']=trim($_RQ['mover_id']);
		$return['params']['mover_id']=trim($_RQ['mover_id']);
	}
	if(!empty($_RQ['card_id'])){
		$params['card_id']=trim($_RQ['card_id']);
		$return['params']['card_id']=trim($_RQ['card_id']);
	}
	if($_RQ['createtime']){
		$time_range=cfc('tools')->base64_decode($_RQ['createtime'],$_SESSION['base_key_str']);
		$time_range=json_decode($time_range,true);
		$return['params']['createtime']=$time_range;
		$params['createtime between']=array($time_range['tstart'],$time_range['tend']);
	}else{
		$return['params']['createtime']=array();
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$fields=array('id','uniacid','mid','card_id','mover_id','createtime');
	$list=pdo_getslice('jy_move_log',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
		
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'挪车记录'),
		),
		'list'=>array('data'=>'list','list'=>array(
			array('name'=>'id','title'=>'ID','type'=>'string'),
			array('name'=>'mover_id','title'=>'挪车人id','type'=>'string'),
			array('name'=>'card_id','title'=>'挪车卡id','type'=>'string'),
			array('name'=>'createtime','title'=>'挪车时间','type'=>'time'),
		)),
		'search'=>array(
		array('name'=>'mover_id','title'=>'挪车人id','type'=>'string'),
		array('name'=>'card_id','title'=>'挪车卡id','type'=>'string'),
		array('name'=>'createtime','title'=>'挪车时间','type'=>'time_range'),
		)
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='del'){
	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_move_log',array('id'=>$id));	
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_move_log',array('id'=>$id));
			}
		}
	}
	exi('删除成功！');
}